Standard Web Error Number Two. There is a difference between the URL for a Design Element (Page, Form, Frameset, View) and a data document. All Design Notes are "peers" in the database. The URL for a Form looks like this:
http://server/path/database.nsf/FormName
The URL for your .js file looks like this:
http://server/path/database.nsf/filename.js
When the .js file is called using a relative URL by filename alone, it will be loaded properly since it appears to be in the same "directory". Now, looking at a document:
http://server/path/database.nsf/ViewName/DocumentUNID
The .js file now appears to be in a higher-level "directory" than the document.
Go to
http://www.codestore.net and search for an article entitled "What to base your links on". It'll give you a way to get rid of the problem.